home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / devel / tcl / tclx7_31.z / tclx7_31 / tcldev / tclX7.3a-p1 / configure.in < prev    next >
Encoding:
Text File  |  1994-01-11  |  16.1 KB  |  463 lines

  1. dnl----------------------------------------------------------------------------
  2. dnl configure.in -
  3. dnl----------------------------------------------------------------------------
  4. dnl  This file is an input file used by the GNU "autoconf" program to
  5. dnl  generate the file "configure", which is run during Tcl installation
  6. dnl  to configure the system for the local environment.  Many of these
  7. dnl  checks are duplicates of those required by Tcl & Tk, since TclX
  8. dnl  includes there internal header files.  The sections from Tcl and Tk
  9. dnl  are grouped together and marked for easy sycning with Outerhout's
  10. dnl  releases.
  11. dnl
  12. dnl  Although the generated configure script is under the GNU Public,
  13. dnl  License Extended Tcl remains freely redistributable for any purpose,
  14. dnl  including commercial use.
  15. dnl----------------------------------------------------------------------------
  16. dnl $Id: configure.in,v 3.2 1994/01/11 06:30:50 markd Exp $
  17. dnl----------------------------------------------------------------------------
  18. AC_INIT(src/tclExtend.h)
  19. ifdef([AC_REVISION],AC_REVISION($Revision: 3.2 $),)dnl
  20.  
  21. AC_CONFIG_HEADER(src/tclXconfig.h)
  22.  
  23. #------------------------------------------------------------------------------
  24. #     Rescan command line looking for the --arch= option.
  25. #------------------------------------------------------------------------------
  26.  
  27. changequote(,)dnl
  28. for arg in $configure_args
  29. do
  30.   # Handle --arch with a space before the argument.
  31.   if test x$next_arch = xyes; then TCL_ARCH=.$arg; next_arch=
  32.   else
  33.     case $arg in
  34.      --arch=*)
  35.     TCL_ARCH=.`echo $arg | sed 's/[-a-z_]*=//'` ;;
  36.      --arch)
  37.     next_arch=yes ;;
  38.     esac
  39.   fi
  40. done
  41.  
  42. if test x$TCL_ARCH = x
  43. then
  44.   echo "No architecture suffix will be used"
  45. else
  46.   echo "An architecture suffix of \"$TCL_ARCH\" will be appended to bin and lib directories."
  47. fi
  48. changequote([,])dnl
  49. AC_SUBST(TCL_ARCH)
  50.  
  51. #------------------------------------------------------------------------------
  52. #     Check for various programs used during the build.
  53. #------------------------------------------------------------------------------
  54.  
  55. AC_PROG_YACC
  56. AC_PROG_RANLIB
  57. CC=${CC-cc}
  58. AC_SUBST(CC)
  59. AC_PROGRAM_CHECK(MCS_CMD, "mcs", [mcs -d], touch)
  60.  
  61. #------------------------------------------------------------------------------
  62. #       Some make programs require includes to be 
  63. #         .include "file"
  64. #     others...
  65. #         include file
  66. #------------------------------------------------------------------------------
  67.  
  68. echo checking how make handles includes
  69. rm -fr conftestdir
  70. if mkdir conftestdir; then
  71.   cd conftestdir
  72.   cat > Makeinclude <<EOF
  73.  
  74. EOF
  75.   cat > Makefile <<EOF
  76. include Makeinclude
  77.  
  78. all:
  79. EOF
  80.   if make >/dev/null 2>/dev/null; then
  81.     MAKEINCLUDE="include"
  82.     MAKEQUOTE=''
  83.   else
  84.     MAKEINCLUDE=".include"
  85.     MAKEQUOTE='"'
  86.   fi
  87.   cd ..
  88.   rm -fr conftestdir
  89. fi
  90. AC_SUBST(MAKEINCLUDE)
  91. AC_SUBST(MAKEQUOTE)
  92.  
  93. #------------------------------------------------------------------------------
  94. #       Check for system header files.
  95. #------------------------------------------------------------------------------
  96.  
  97. AC_HEADER_CHECK(values.h, , AC_DEFINE(NO_VALUES_H))
  98. AC_HEADER_CHECK(sys/socket.h, , AC_DEFINE(NO_SYS_SOCKET_H))
  99.  
  100. #------------------------------------------------------------------------------
  101. #       Check for missing functions that we need.  They will be
  102. #       compiled in the osSupport directory. Must check for SCO
  103. #       -lintl, which is were strftime is hidden.
  104. #------------------------------------------------------------------------------
  105.  
  106. AC_SCO_INTL
  107. AC_FUNC_CHECK(strftime, ,[LIBOBJS="$LIBOBJS strftime.o"])
  108. AC_FUNC_CHECK(random, ,[LIBOBJS="$LIBOBJS random.o"])
  109. AC_FUNC_CHECK(rename, ,[LIBOBJS="$LIBOBJS rename.o"])
  110. AC_SUBST(LIBOBJS)
  111.  
  112. #------------------------------------------------------------------------------
  113. #       Check for missing typedefs.
  114. #------------------------------------------------------------------------------
  115.  
  116. AC_COMPILE_CHECK(time_t, [#include <sys/types.h>], , , AC_DEFINE(time_t, long))
  117.  
  118. #------------------------------------------------------------------------------
  119. #       What type do signals return?
  120. #------------------------------------------------------------------------------
  121.  
  122. AC_RETSIGTYPE
  123.  
  124. #------------------------------------------------------------------------------
  125. #       Find out all about time handling differences.
  126. #------------------------------------------------------------------------------
  127.  
  128. AC_TIME_WITH_SYS_TIME
  129. AC_TIMEZONE
  130.  
  131. AC_COMPILE_CHECK([tm_tzadj in struct tm], $decl,
  132. [struct tm tm; tm.tm_tzadj;], AC_DEFINE(HAVE_TM_TZADJ), )
  133.  
  134. AC_COMPILE_CHECK([tm_gmtoff in struct tm], $decl,
  135. [struct tm tm; tm.tm_gmtoff;], AC_DEFINE(HAVE_TM_GMTOFF), )
  136.  
  137. AC_HAVE_FUNCS(gettimeofday)
  138.  
  139. AC_COMPILE_CHECK([timezone variable], , [
  140. extern long timezone;
  141. timezone += 1;
  142. exit (0);
  143. ], AC_DEFINE(HAVE_TIMEZONE_VAR))
  144.  
  145. #------------------------------------------------------------------------------
  146. #     Test to see if "times" returns a status or the amount of
  147. #     elapsed real time.
  148. #------------------------------------------------------------------------------
  149.  
  150. echo "checking to see if 'times' returns the elapsed real time"
  151. AC_TEST_PROGRAM([
  152. #include <sys/types.h>
  153. #include <sys/times.h>
  154. main() {
  155. struct tms cpu;
  156. times (&cpu);
  157. sleep (2);
  158. if (times (&cpu) > 0)
  159.      exit (0);
  160. else 
  161.      exit (1);
  162. }
  163. ], AC_DEFINE(TIMES_RETS_REAL_TIME), )
  164.  
  165. #------------------------------------------------------------------------------
  166. #     Determine if "." is used as separator for the manual directory
  167. #     names.  i.e. man/man.1 vs man/man1
  168. #------------------------------------------------------------------------------
  169.  
  170. echo "checking man directory/section separator (man/man.1 vs man/man1)"
  171. mandirs="/usr/man/man.1 /usr/man/cat.1 /usr/share/man.1 /usr/share/man.1 
  172.         /usr/man/cat.C"
  173. gotdotdir="NO"
  174. for d in $mandirs
  175. do
  176.     if test -d $d
  177.     then
  178.         gotdotdir="YES"
  179.     fi
  180. done
  181.  
  182. mandirs="/usr/man/man1   /usr/man/cat1   /usr/share/man1   /usr/share/man1
  183.          /usr/man/man1.Z /usr/man/cat1.Z /usr/share/man1.Z /usr/share/man1.Z"
  184. gotnodotdir="NO"
  185. for d in $mandirs
  186. do
  187.     if test -d $d
  188.     then
  189.         gotnodotdir="YES"
  190.     fi
  191. done
  192.  
  193. if test $gotdotdir = YES -a $gotnodotdir = NO
  194. then
  195.     MAN_DIR_SEPARATOR="."
  196. elif test $gotdotdir = NO -a $gotnodotdir = YES
  197. then
  198.     MAN_DIR_SEPARATOR=""
  199. else
  200.     MAN_DIR_SEPARATOR="."
  201.     echo "WARNING: could not determine man directory/section separator"
  202.     echo "         assuming man/man.1 (can override in Config.mk)."
  203. fi
  204. AC_SUBST(MAN_DIR_SEPARATOR)
  205.  
  206. #------------------------------------------------------------------------------
  207. # Define srcbasedir and bldbasedir as absolute paths.
  208. #------------------------------------------------------------------------------
  209.  
  210. srcbasedir=`cd $srcdir;pwd`
  211. AC_SUBST(srcbasedir)
  212. bldbasedir=`pwd`
  213. AC_SUBST(bldbasedir)
  214.  
  215. #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  216. #                      Begin code from Tcl configure.in
  217. #------------------------------------------------------------------------------
  218.  
  219. #--------------------------------------------------------------------
  220. #       Supply substitutes for missing POSIX library procedures, or
  221. #       set flags so Tcl uses alternate procedures.
  222. #--------------------------------------------------------------------
  223.  
  224. AC_FUNC_CHECK(gettimeofday, , AC_DEFINE(NO_GETTOD))
  225.  
  226. #--------------------------------------------------------------------
  227. #       Supply substitutes for missing POSIX header files.  Special
  228. #       notes:
  229. #           - Sprite's dirent.h exists but is bogus.
  230. #           - stdlib.h doesn't define strtol, strtoul, or
  231. #             strtod insome versions of SunOS
  232. #           - some versions of string.h don't declare procedures such
  233. #             as strstr
  234. #--------------------------------------------------------------------
  235.  
  236. AC_UNISTD_H
  237. AC_COMPILE_CHECK(dirent.h, [#include <sys/types.h>
  238. #include <dirent.h>], [
  239. DIR *d;
  240. struct dirent *entryPtr;
  241. char *p;
  242. d = opendir("foobar");
  243. entryPtr = readdir(d);
  244. p = entryPtr->d_name;
  245. closedir(d);
  246. ], tcl_ok=1, tcl_ok=0)
  247. AC_HEADER_EGREP([Sprite version.* NOT POSIX], tcl_ok=0)
  248. if test $tcl_ok = 0; then
  249.     AC_DEFINE(NO_DIRENT_H)
  250. fi
  251. AC_HEADER_CHECK(errno.h, , AC_DEFINE(NO_ERRNO_H))
  252. AC_HEADER_CHECK(float.h, , AC_DEFINE(NO_FLOAT_H))
  253. AC_HEADER_CHECK(limits.h, , AC_DEFINE(NO_LIMITS_H))
  254. AC_HEADER_CHECK(stdlib.h, tcl_ok=1, tcl_ok=0)
  255. AC_HEADER_EGREP(strtol, stdlib.h, , tcl_ok=0)
  256. AC_HEADER_EGREP(strtoul, stdlib.h, , tcl_ok=0)
  257. AC_HEADER_EGREP(strtod, stdlib.h, , tcl_ok=0)
  258. if test $tcl_ok = 0; then
  259.     AC_DEFINE(NO_STDLIB_H)
  260. fi
  261. AC_HEADER_CHECK(string.h, tcl_ok=1, tcl_ok=0)
  262. AC_HEADER_EGREP(strstr, string.h, , tcl_ok=0)
  263. AC_HEADER_EGREP(strerror, string.h, , tcl_ok=0)
  264. if test $tcl_ok = 0; then
  265.     AC_DEFINE(NO_STRING_H)
  266. fi
  267. AC_HEADER_CHECK(sys/time.h, , AC_DEFINE(NO_SYS_TIME_H))
  268. AC_HEADER_CHECK(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))
  269.  
  270. #--------------------------------------------------------------------
  271. #       Check for various typedefs and provide substitutes if
  272. #       they don't exist.
  273. #--------------------------------------------------------------------
  274.  
  275. AC_MODE_T
  276. AC_PID_T
  277. AC_SIZE_T
  278. AC_UID_T
  279.  
  280. #--------------------------------------------------------------------
  281. #       If a system doesn't have an opendir function (man, that's old!)
  282. #       then we have to supply a different version of dirent.h which
  283. #       is compatible with the substitute version of opendir that's
  284. #       provided.  This version only works with V7-style directories.
  285. #--------------------------------------------------------------------
  286.  
  287. AC_FUNC_CHECK(opendir, , AC_DEFINE(USE_DIRENT2_H))
  288.  
  289. #--------------------------------------------------------------------
  290. #       The check below checks whether <sys/wait.h> defines the type
  291. #       "union wait" correctly.  It's needed because of weirdness in
  292. #       HP-UX where "union wait" is defined in both the BSD and SYS-V
  293. #       environments.  Checking the usability of WIFEXITED seems to do
  294. #       the trick.
  295. #--------------------------------------------------------------------
  296.  
  297. AC_COMPILE_CHECK([union wait], [#include <sys/types.h> 
  298. #include <sys/wait.h>], [
  299. union wait x;
  300. WIFEXITED(x);           /* Generates compiler error if WIFEXITED
  301.                          * uses an int. */
  302. ], , AC_DEFINE(NO_UNION_WAIT))
  303.  
  304. #------------------------------------------------------------------------------
  305. #                       End code from Tcl configure.in
  306. #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  307.  
  308.  
  309. #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  310. #                      Begin code from Tk configure.in
  311. # Notes: Added check for X11_s.
  312. #------------------------------------------------------------------------------
  313.  
  314. #--------------------------------------------------------------------
  315. #    Include sys/select.h if it exists and if it supplies things
  316. #    that appear to be useful and aren't already in sys/types.h.
  317. #    This appears to be true only on the RS/6000 under AIX.  Some
  318. #    systems like OSF/1 have a sys/select.h that's of no use, and
  319. #    other systems like SCO UNIX have a sys/select.h that's
  320. #    pernicious.  If "fd_set" isn't defined anywhere then set a
  321. #    special flag.
  322. #--------------------------------------------------------------------
  323.  
  324. echo checking for sys/select.h
  325. AC_COMPILE_CHECK(fd_set, [#include <sys/types.h>],
  326.     [fd_set readMask, writeMask;], ,
  327.     AC_HEADER_EGREP(fd_mask, sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H),
  328.         AC_DEFINE(NO_FD_SET)))
  329.  
  330. #--------------------------------------------------------------------
  331. #    Locate the X11 header files and the X11 library archive.  Try
  332. #    the ac_find_x macro first, but if it doesn't find the X stuff
  333. #    (e.g. because there's no xmkmf program) then check through
  334. #    a list of possible directories.
  335. #--------------------------------------------------------------------
  336.  
  337. AC_PROGRAM_CHECK(tk_ok, xmkmf, 1, 0)
  338. if test $tk_ok = 1; then
  339.     AC_FIND_X
  340. fi
  341. if test "$XINCLUDE_DIR" != ""; then
  342.      x_includes="$XINCLUDE_DIR"
  343. fi
  344. if test "$x_includes" = /usr/include; then
  345.     XINCLUDES="# no special path needed"
  346. elif test "$x_includes" != ""; then
  347.     XINCLUDES=" -I$x_includes"
  348. else
  349.     echo checking for X11 header files
  350.     XINCLUDES="# no special path needed"
  351.     AC_TEST_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
  352.     if test "$XINCLUDES" = nope; then
  353.         dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/include/X11R4 /usr/X11R5/include /usr/include/X11R5 /usr/openwin/include /usr/X11/include"
  354.         for i in $dirs ; do
  355.         if test -r $i/X11/Intrinsic.h; then
  356.             XINCLUDES=" -I$i"
  357.         fi
  358.         done
  359.     fi
  360. fi
  361. if test "$XINCLUDES" = nope; then
  362.   echo "Warning:  couldn't find any X11 include files."
  363.   XINCLUDES="# no include files found"
  364. fi
  365. AC_SUBST(XINCLUDES)
  366.  
  367. if test "$XLIBRARY_DIR" != ""; then
  368.     x_libraries="$XLIBRARY_DIR"
  369. fi
  370. if test "$x_libraries" = /usr/lib; then
  371.     XLIBSW=-lX11
  372. elif test "$x_libraries" != ""; then
  373.     XLIBSW="-L$x_libraries -lX11"
  374. else
  375.     echo "checking for X11 library archive"
  376.     AC_HAVE_LIBRARY(X11_s, XLIBSW="-lX11_s", XLIBSW=nope)
  377.     if test "$XLIBSW" = nope; then
  378.         AC_HAVE_LIBRARY(X11, XLIBSW="-lX11", XLIBSW=nope)
  379.     fi
  380.     if test "$XLIBSW" = nope; then
  381.     dirs=${XLIBRARY_DIR-"/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/lib/X11R4 /usr/X11R5/lib /usr/lib/X11R5 /usr/openwin/lib /usr/X11/lib"}
  382.         for i in $dirs ; do
  383.         if test -r $i/libX11.a; then
  384.         XLIBSW="-L$i -lX11"
  385.         fi
  386.     done
  387.     fi
  388. fi
  389. if test "$XLIBSW" = nope ; then
  390.     AC_HAVE_LIBRARY(Xwindow, XLIBSW=-lXwindow)
  391. fi
  392. if test "$XLIBSW" = nope ; then
  393.     echo "Warning:  couldn't find the X11 library archive.  Using -lX11."
  394.     XLIBSW=-lX11
  395. fi
  396. AC_SUBST(XLIBSW)
  397.  
  398. #------------------------------------------------------------------------------
  399. #       Check for the existence of various libraries.  The order here
  400. #       is important, so that then end up in the right order in the
  401. #       command line generated by Make.
  402. #------------------------------------------------------------------------------
  403.  
  404. AC_HAVE_LIBRARY(Xbsd, [LIBS="$LIBS -lXbsd"])
  405. AC_HAVE_LIBRARY(socket, [LIBS="$LIBS -lsocket"])
  406. AC_HAVE_LIBRARY(nsl, [LIBS="$LIBS -lnsl"])
  407.  
  408. #------------------------------------------------------------------------------
  409. #                       End code from Tk configure.in
  410. #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  411.  
  412. #------------------------------------------------------------------------------
  413. #       Check for additional libraries the Tcl/Tk does not check for.
  414. #------------------------------------------------------------------------------
  415.  
  416. AC_HAVE_LIBRARY(sun, [LIBS="$LIBS -lsun"])
  417. AC_HAVE_LIBRARY(c_s, [LIBS="$LIBS -lc_s"])
  418. AC_HAVE_LIBRARY(ieee, [LIBS="$LIBS -lieee"])
  419.  
  420. #------------------------------------------------------------------------------
  421. #       Check for various Unix or library functions that can be used by TclX.
  422. #       These must be after the library checks.
  423. #------------------------------------------------------------------------------
  424.  
  425. AC_HAVE_FUNCS(catgets getcwd select setitimer setlinebuf sigaction setpgid)
  426. AC_HAVE_FUNCS(bzero bcopy gethostbyname fsync getpriority)
  427.  
  428. #------------------------------------------------------------------------------
  429. #       If Config.mk is not in the build directory, copy it local.
  430. #------------------------------------------------------------------------------
  431.  
  432. if test ! -r Config.mk
  433. then
  434.     echo "Copying $srcdir/Config.mk to build directory"
  435.     cp $srcdir/Config.mk  Config.mk || exit 1
  436. fi
  437.  
  438. #------------------------------------------------------------------------------
  439. #       Copy the tests to the build directory if they are not there.
  440. #       We could do something fancier, but this is easy for now.
  441. #------------------------------------------------------------------------------
  442.  
  443. if test ! -d tests
  444. then
  445.     echo "Copying $srcdir/tests contents to build directory"
  446.     mkdir tests
  447.     # Prevent line to long on some systems.
  448.     CURDIR=`pwd`
  449.     cd $srcdir/tests
  450.     cp *.test *.tcl all $CURDIR/tests || exit 1
  451.     cd $CURDIR
  452. fi
  453.  
  454. #------------------------------------------------------------------------------
  455. # Generate the make files.
  456. #------------------------------------------------------------------------------
  457.  
  458. AC_SUBST(prefix)
  459. AC_SUBST(execprefix)
  460.  
  461. AC_OUTPUT(Makefile osSupport/Makefile src/Makefile tclsrc/Makefile tksrc/Makefile tktclsrc/Makefile tools/Makefile src/SYSLIBS tksrc/SYSLIBS)
  462.